package com.lfy.auth.controller;

import com.lfy.auth.domain.entity.UserEntity;
import com.lfy.auth.domain.req.ChangeNameReq;
import com.lfy.auth.domain.req.ChangeSignatureReq;
import com.lfy.auth.service.UserDetailService;
import com.lfy.common.result.R;
import com.lfy.commons.anno.user.AutoUser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
/**
 * 用户资料相关Controller
 *
 * @author <a href="https://www.lvfeiy.top">吕飞扬</a>
 * @date 2023/10/21 16:22
 */
@RequestMapping("/user")
@RestController
public class UserController {
    @Resource
    private UserDetailService userDetailServicel;

    /**
     * 改名字
     * @param user user
     * @param req name
     * @return R
     */
    @PostMapping("/changeName")
    public R<Void> changeName(@AutoUser UserEntity user, @Valid @RequestBody ChangeNameReq req){
        return this.userDetailServicel.changeName(user,req);
    }

    /**
     * 改签名
     * @param user user
     * @param req sig
     * @return R
     */
    @PostMapping("/changeSignature")
    public R<Void> changeSignature(@AutoUser UserEntity user, @Valid @RequestBody ChangeSignatureReq req){
        return this.userDetailServicel.changeSignature(user,req);
    }


}
